package com.yxy.controller.user;

import com.yxy.common.PageResult;
import com.yxy.common.Result;
import com.yxy.constant.RequestMapperConstant;
import com.yxy.pojo.dto.HotelCollectPageQueryDTO;
import com.yxy.pojo.dto.SightsCollectPageQueryDTO;
import com.yxy.pojo.entity.SightsCollect;
import com.yxy.service.CollectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(RequestMapperConstant.USER_REQUEST_MAPPER + "collect")
@Slf4j
public class CollectController {

    @Autowired
    private CollectService collectService;

    /**
     * 修改景点收藏状态
     * @return
     */
    @PutMapping("/updateSightsCollectStatus/{id}/{status}")
    public Result updateSightsCollectStatus(@PathVariable Integer id, @PathVariable Integer status){
        log.info("修改收藏状态：{}, {}", id, status);
        collectService.updateSightsStatus(id, status);
        return Result.success("", null);
    }

    /**
     * 修改酒店收藏状态
     * @param id
     * @param status
     * @return
     */
    @PutMapping("/updateHotelCollectStatus/{id}/{status}")
    public Result updateHotelCollectStatus(@PathVariable Integer id, @PathVariable Integer status){
        log.info("修改收藏状态：{}, {}", id, status);
        collectService.uppdateHotelStatus(id, status);
        return Result.success("", null);
    }

    /**
     * 分页查询景点收藏
     * @param sightsCollectPageQueryDTO
     * @return
     */
    @GetMapping("/pageQuerySightsCollect")
    public Result<PageResult> pageQuerySightsCollect(SightsCollectPageQueryDTO sightsCollectPageQueryDTO){
        log.info("分页查询景点收藏：{}", sightsCollectPageQueryDTO);
        PageResult pageResult = collectService.pageQuerySightsCollect(sightsCollectPageQueryDTO);
        return Result.success("", pageResult);
    }

    /**
     * 分页查询酒店收藏
     * @param hotelCollectPageQueryDTO
     * @return
     */
    @GetMapping("/pageQueryHotelCollect")
    public Result<PageResult> pageQueryHotelCollect(HotelCollectPageQueryDTO hotelCollectPageQueryDTO){
        log.info("分页查询酒店收藏：{}", hotelCollectPageQueryDTO);
        PageResult pageResult = collectService.pageQueryHotelCollect(hotelCollectPageQueryDTO);
        return Result.success("", pageResult);
    }
}
